package com.nxcy.caculator;

import com.nxcy.caculator.oper.*;

import java.util.Scanner;

public class Caculator2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入第一个操作数");
        double num1 = sc.nextInt();
        System.out.println("请输入操作符");
        String oper = sc.next();
        System.out.println("请输入第二个操作数");
        double num2 = sc.nextInt();
        double result = 0;
        Operation operation=null;

        switch (oper) {
            case "+": {
                 operation=new Add();
                break;
            }
            case "-": {
                operation=new Sub();
                break;
            }
            case "*": {
                operation=new Mut();
                break;
            }
            case "/": {
                operation=new Div();
                break;
            }
            default: {
                break;
            }
        }

        System.out.println(num1 + oper + num2 + "=" + operation.caculate(num1,num2));
    }
}
